{% extends "profiles/base.html" %}

{% load i18n %}
{% load avatar_tags %}
{% load app_plugins %}
{% load schedule_cal_tags %}

{% block head_title %}{% blocktrans %}Profile for {{ other_user }}{% endblocktrans %}{% endblock %}

{% block body %}
    {% comment %}
    <div class="right_panel">
        {% include "profiles/profile_right_panel.html" %}
    </div>
    {% endcomment %}

    <div class="left_panel">
		{% if is_me %}
			<a href={{calendar.add_event_url}}>Add event to calendar</a>
		{% endif %}
		{% comment %}
        <div id="profile_avatar">
            <div>{% avatar other_user 80 %}</div>
            <a href="{% url avatar_change %}" id="avatar_replace">(replace)</a>
        </div>
		{% endcomment %}
		{% if other_user.get_full_name %}
			<p>
				{% comment %}
				<a href="{% url messages_compose %}{{ other_user }}/">Send a message to {{ other_user.get_full_name }}</a>.
				{% endcomment %}
				<form method="GET" action="{% url messages_compose %}{{ other_user }}/" >
					<input type="hidden" name="next" value="{% url profiles.views.profile other_user.username %}" />
					<input type="submit" name="submit" value="Send a message to {{ other_user.get_full_name }}" />
				</form>
			</p>
			{% comment %}
			<p>
				<a href="mailto:{{ other_user.email }}">Send an email to {{ other_user.get_full_name }}</a>.
			</p>	
			{% endcomment %}		
			<h1 style="margin-top: 1em; margin-bottom: 1em;" >Profile for {{ other_user.get_full_name }}</h1>
		{% else %}
			<p>
				{% comment %}
				<a href="{% url messages_compose %}{{ other_user }}/">Send a message to {{ other_user }}</a>.
				{% endcomment %}
				<form method="GET" action="{% url messages_compose %}{{ other_user }}/" >
					<input type="hidden" name="next" value="{% url profiles.views.profile other_user.username %}" />
					<input type="submit" name="submit" value="Send a message to {{ other_user }}" />
				</form>
			</p>
			{% comment %}
			<p>
				<a href="mailto:{{ other_user.email }}">Send an email to {{ other_user }}</a>.
			</p>	
			{% endcomment %}		
			<h1 style="margin-top: 1em; margin-bottom: 1em;" >Profile for {{ other_user }}</h1>		
		{% endif %}
    
        <div class="profile_info">
            {% if other_user.get_profile.name %}<p><b>{% trans "Name" %}</b>: {{ other_user.get_profile.name }}</p>{% endif %}
			{% if other_user.email %}
				<p>
					<b>{% trans "Email" %}</b>: 
					<a href="mailto:{{ other_user.email }}">{{ other_user.email }}</a>
				</p>
			{% endif %}
            {% if other_user.get_profile.home_phone %}<p><b>{% trans "Home Phone" %}</b>: {{ other_user.get_profile.home_phone }}</p>{% endif %}
            {% if other_user.get_profile.work_phone%}<p><b>{% trans "Work Phone" %}</b>: {{ other_user.get_profile.work_phone }}</p>{% endif %}
            {% if other_user.get_profile.cell_phone %}<p><b>{% trans "Cell Phone" %}</b>: {{ other_user.get_profile.cell_phone }}</p>{% endif %}
        </div>
		
		{% if is_me %}
			<div class="form-toggle">
				<p><a href="" id="edit-profile-toggle">{% trans "Edit profile" %}</a></p>
				<form id="edit-profile" method="POST" action="" style="display: none;">
					<table>
						{{ profile_form }}
						<tr><td></td><td><input type="hidden" name="action" value="update" /><input type="submit" value="{% trans "update" %}"/></td></tr>
					</table>
				</form>
			</div>
		{% endif %}
    
    </div>
{% endblock %}

{% block extra_body %}
    <script type="text/javascript">
        $(document).ready(function() {
            $('#edit-profile').hide();
            $('#edit-profile-toggle').click(function() {
                $('#edit-profile').slideToggle();
                $('#edit-profile').autoscroll();
                return false;
            });
            if ($('#edit-profile ul.errorlist').length) {
                $('#edit-profile').show();
                $('#edit-profile ul.errorlist').autoscroll();
            }
        });
    </script>
{% endblock %}